import request from '../utils/request'

/**
 * 
 * @param {email, password} user 
 * @returns 
 */
export const login = user => request({
    method: 'post',
    url: '/api/users/login',
    data: {
        user
    }
})

/**
 * 
 * @param {email, password, username} user 
 * @returns 
 */
export const register = user => request({
    method: 'post',
    url: '/api/users',
    data: {
        user
    }
})

/**
 * 
 * @returns 
 */
export const user = () => request({
    method: 'get',
    url: '/api/user'
})

/**
 * 
 * @param {email, username, password, image, bio} user 
 * @returns 
 */
export const update = user => request({
    method: 'put',
    url: '/api/user',
    data: {
        user
    }
})